/**
 *
 */
package com.hanhai.zrb.backend.admin.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hanhai.common.cache.Cache;
import com.hanhai.zrb.backend.admin.dao.mybatis.BackUserDao;
import com.hanhai.zrb.backend.admin.model.BackUser;
import com.hanhai.zrb.backend.admin.service.BackUserService;

@Service("backUserService")
public class BackUserServiceImpl implements BackUserService {

	@Resource
	private BackUserDao backUserDao;
	
	
	
	@Resource
	private Cache defaultCache;
	
	
	@Override
	public void addBackUser(Map<String, Object> params) {
		this.backUserDao.addBackUser(params);
	}
	@Override
	public void updateBackUser(Map<String, Object> params) {
		this.backUserDao.updateBackUser(params);
	}
	@Override
	public List<Map<String, Object>> listAll() {
		return backUserDao.listAll();
	}
	@Override
	public Map<String, Object> getBackUser(Integer id) {
		return backUserDao.getBackUser(id);
	}
	@Override
	public List<BackUser> searchByName(String name) {
		return backUserDao.searchByName(name);
	}
	@Override
	public BackUser getByUid(Long uid) {
		return backUserDao.getByUid(uid);
	}
	@Override
	public Map<String, Map<String, Object>> getBackUserMap() {
		Map<String, Map<String, Object>> mapRet =new HashMap<String, Map<String,Object>>();
		List<Map<String, Object>> list = backUserDao.listAll();
		for(Map<String, Object> map:list){
			mapRet.put(map.get("id").toString(), map);
		}
		
		return mapRet;
	}
	

}
